<template>
  <div id="equip-table">
    <div class="tab-top">巡检</div>
    <div class="tab-btn">
      <el-button size="mini" class="add">新增</el-button>
    </div>
    <div class="tab-table">
      <el-table :data="tableData" style="width: 100%" stripe>
        <el-table-column prop="date" label="日期" width="150">
        </el-table-column>
        <el-table-column prop="name" label="姓名" width="155">
        </el-table-column>
        <el-table-column prop="province" label="省份" width="155">
        </el-table-column>
        <el-table-column prop="city" label="市区" width="155">
        </el-table-column>
        <el-table-column prop="address" label="地址" width="205">
        </el-table-column>
        <el-table-column label="操作" width="155">
          <template slot-scope="scope">
            <el-button
              @click="handleClick(scope.row)"
              type="primary"
              size="mini"
              style="width: 55px; height: 20px"
              >查看</el-button
            >

            <el-button
              type="primary"
              size="mini"
              style="width: 55px; height: 20px"
              >编辑</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-dialog
        title="表格内容"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
      >
        <el-form ref="salesForm">
          <el-form-item label="日期">
            <el-input v-model="salesForm.date" disabled></el-input>
          </el-form-item>
          <el-form-item label="姓名">
            <el-input v-model="salesForm.name" disabled></el-input>
          </el-form-item>
          <el-form-item label="省份">
            <el-input v-model="salesForm.province" disabled></el-input>
          </el-form-item>
          <el-form-item label="市区">
            <el-input v-model="salesForm.city" disabled></el-input>
          </el-form-item>
          <el-form-item label="地址">
            <el-input v-model="salesForm.address" disabled></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogVisible = false"
            >确 定</el-button
          >
        </span>
      </el-dialog>
    </div>
    <div class="tab-pag">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage"
        :page-size="10"
        layout="prev, pager, next"
        :total="100"
      >
      </el-pagination>
    </div>
  </div>
</template>
<script>
import "../../assets/equipTable.css";
export default {
  name: "equipTable",
  components: {},
  props: {},
  data() {
    return {
      dialogVisible: false,
      currentPage: 1,
      salesForm: {
        date: "",
        name: "",
        province: "",
        city: "",
        address: "",
      },
      tableData: [
        {
          date: "2016-05-02",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路弄",
        },
        {
          date: "2016-05-04",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路弄",
        },
        {
          date: "2016-05-01",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路弄",
        },
        {
          date: "2016-05-03",
          name: "王小虎",
          province: "上海",
          city: "普陀区",
          address: "上海市普陀区金沙江路弄",
        },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    handleClick(row) {
      this.dialogVisible = true;
      this.salesForm = row;
      console.log(row);
    },
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.currentPage = 1;
      this.pageSize = val;
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.currentPage = val;
    },
  },
};
</script>
<style scoped>
#equip-table {
  width: 82%;
  height: 90%;
  float: right;
  margin: 15px 15px 0 0;
  background: #1144ab;
  border: 1px solid #669dff;
}
.el-button--mini,
.el-button--mini.is-round {
  padding: 4px 15px;
}
.tab-top {
  width: 100%;
  height: 5%;
  background: #0f3071;
}
.tab-btn {
  margin: 20px;
}
.add {
  background: #1077cf;
  border: 1px solid #0372d5;
  border-radius: 3px;
  color: #fff;
}
.tab-table {
  width: 96%;
  height: 70%;
  margin: 0 auto;
  border: 1px solid #669dff;
}
.el-table {
  background: transparent !important;
}
.el-table /deep/th {
  font-size: 14px;
  font-weight: normal;
  background: #0f3071;
  color: #fff;
  text-align: center;
}
/* 非斑马纹背景 */
::v-deep .el-table .el-table__body tr.el-table__row td {
  background: #1144ab;
  padding: 3px;
}
/*斑马纹背景 */
::v-deep .el-table--striped .el-table__body tr.el-table__row--striped td {
  background: #0f3071;
  color: #fff;
  opacity: 0.9;
  padding: 3px;
}

/* 斑马纹颜色定义完之后会显示自带的边框颜色，这里要重置 */
::v-deep .el-table td,
.building-top .el-table th.is-leaf {
  border: none;
  color: white;
}
/* 最上边的边框颜色 */
#equip-table ::v-deep .el-table th {
  border-bottom: none !important;
}
#equip-table ::v-deep .el-table .cell {
  text-align: center;
}
/* 最底部的边框颜色 */
::v-deep .el-table__fixed-right::before,
.el-table__fixed::before {
  background: transparent !important;
}
::v-deep .el-table--border::after,
.el-table--group::after,
.el-table::before {
  background: transparent !important;
}
.tab-pag {
  float: right;
  margin-right: 15px;
  margin-top: 15px;
}
</style>
